package com.rabbitmq.producer;

import com.rabbitmq.entity.MessageEntity;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @author ZH
 */
@Service
public class MessageService {
    @Autowired
    RabbitTemplate rabbitTemplate;

    public void sendDirectMessage(MessageEntity messageEntity) {
        rabbitTemplate.convertAndSend("direct_exchange", "TestDirectRouting", messageEntity);
    }
}
